<template>
  <div class="p-3">
    <ma-form v-model="form" :options="options" :columns="columns"></ma-form>
  </div>
</template>
<script setup>
import { ref } from 'vue'
import dayjs from 'dayjs'

const form = ref({
  createUser: '狂徒张三',
  createTime: dayjs().format('YYYY-MM-DD'),
  auditReportType: '0',
  firmOfficeArea: { province: '河南省', city: '洛阳市' },
})
const auditReportTypeData = [
  { label: '年报审计', value: '0' },
  { label: '净资产专项审计', value: '1' },
  { label: '财务尽职调查', value: '2' },
  { label: '资产清查专项审计', value: '3' },
]
const options = ref({
  showFormTitle: true,
  formTitle: '新增审计报告',
})
const columns = ref([
  {
    formType: 'card',
    title: '基础信息',
    customClass: ['mt-3'],
    bodyStyle: { paddingBottom: 0, },
    formList: [
      {
        title: '审计报告类型', dataIndex: 'auditReportType', formType: 'radio', labelWidth: '135px',
        dict: { data: auditReportTypeData },
      },
      {
        formType: 'grid-tailwind',
        customClass: ['mt-5'],
        colNumber: 2,
        cols: [
          {
            formList: [{
              dataIndex: 'auditName', title: '报告名称', labelWidth: '150px',
              rules: [{ required: true, message: '请输入报告名称' }]
            }]
          },
          {
            formList: [{
              dataIndex: 'createTime', title: '创建日期', formType: 'date', labelWidth: '150px',
              rules: [{ required: true, message: '请选择创建日期' }]
            }]
          },
          {
            formList: [{
              dataIndex: 'createUser', title: '创建人', disabled: true, labelWidth: '150px',
            }]
          },
        ]
      },
      {
        formType: 'grid-tailwind',
        colNumber: 2,
        cols: [
          {
            formList: [{
              dataIndex: 'signCPA1', title: '签字注册会计师-1', labelWidth: '150px'
            }]
          },
          {
            formList: [{
              dataIndex: 'signCPA2', title: '签字注册会计师-2', labelWidth: '150px'
            }]
          }
        ]
      },
    ]
  },
  {
    formType: 'card',
    title: '事务所信息',
    customClass: ['mt-3'],
    bodyStyle: { paddingBottom: 0, },
    formList: [
      {
        dataIndex: 'firmCnName', title: '事务所中文全称', labelWidth: '130px',
        rules: [{ required: true, message: '请输入事务所中文全称' }]
      },
      {
        dataIndex: 'firmCnAbbrName', title: '事务所中文简称', labelWidth: '130px',
        rules: [{ required: true, message: '请输入事务所中文简称' }]
      },
      {
        dataIndex: 'firmEnName', title: '事务所英文全称', labelWidth: '130px',
        rules: [{ required: true, message: '请输入事务所英文简称' }]
      },
      {
        dataIndex: 'firmEnAbbrName', title: '事务所英文简称', labelWidth: '130px',
        rules: [{ required: true, message: '请输入事务所英文简称' }]
      },
      {
        dataIndex: 'firmOfficeArea', title: '事务所行政区域', labelWidth: '130px', formType: 'city-linkage',
        rules: [{ required: true, message: '请输入事务所英文简称' }]
      },
    ],
  },
  {
    formType: 'card',
    title: '被审计单位信息',
    customClass: ['mt-3', 'mb-5'],
    formList: [
      {
        title: '基础信息', formType: 'divider', orientation: 'left', margin: '30px',
      },
      {
        formType: 'grid-tailwind',
        customClass: ['mt-5'],
        colNumber: 2,
        cols: [
          {
            formList: [{
              dataIndex: 'companyName', title: '单位名称', labelWidth: '170px',
              rules: [{ required: true, message: '请输入单位名称' }]
            }]
          },
          {
            formList: [{
              dataIndex: 'subscribeRegisterCapital', title: '认缴注册资本', labelWidth: '150px',
              rules: [{ required: true, message: '请输入认缴注册资本' }]
            }]
          },
          {
            formList: [{
              dataIndex: 'companyCreditCode', title: '统一社会信用代码', labelWidth: '170px',
              rules: [{ required: true, message: '请输入统一社会信用代码' }]
            }]
          },
          {
            formList: [{
              dataIndex: 'corporate', title: '法定代表人', labelWidth: '150px',
              rules: [{ required: true, message: '请输入法定代表人' }]
            }]
          }
        ]
      },
      {
        dataIndex: 'actualControl', title: '实际控制人', labelWidth: '150px',
        rules: [{ required: true, message: '请输入实际控制人' }]
      },
      {
        dataIndex: 'registerArea', title: '注册地区', labelWidth: '150px', formType: 'city-linkage',
        rules: [{ required: true, message: '请选择企业注册地区' }]
      },
      {
        dataIndex: 'detailAddress', title: '详细地址', labelWidth: '150px',
        rules: [{ required: true, message: '请输入详细地址' }]
      },
      {
        dataIndex: 'businessScope', title: '经营范围', labelWidth: '150px', formType: 'textarea',
        rules: [{ required: true, message: '请输入经营范围' }]
      },
      {
        title: '股东信息', formType: 'divider', orientation: 'left', margin: '30px',
      },
      {
        title: '股东列表', dataIndex: 'shareholderInfo', formType: 'children-form', type: 'table', emptyRow: 2,
        formList: [
          { title: '股东名称', dataIndex: 'name', rules: [{ required: true, message: '请输入股东名称' }] },
          { title: '认缴资本金',formType: 'upload',multiple: true, dataIndex: 'registerCapital', rules: [{ required: true, message: '请输入认缴资本金' }] },
          { title: '认缴比例', dataIndex: 'registerShareRatio', rules: [{ required: true, message: '请输入认缴比例' }] },
          { title: '实缴比例', dataIndex: 'actualShareRatio', rules: [{ required: true, message: '请输入实缴比例' }] }
        ]
      }
    ],
  },
])
</script>
